{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Tích hợp với Hugging Face Hub"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Install the Transformers, Datasets, and Evaluate libraries to run this notebook."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install datasets evaluate transformers[sentencepiece]\n",
    "!pip install gradio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import gradio as gr\n",
    "\n",
    "title = \"GPT-J-6B\"\n",
    "description = \"Gradio Demo for GPT-J 6B, a transformer model trained using Ben Wang's Mesh Transformer JAX. 'GPT-J' refers to the class of model, while '6B' represents the number of trainable parameters. To use it, simply add your text, or click one of the examples to load them. Read more at the links below.\"\n",
    "article = \"<p style='text-align: center'><a href='https://github.com/kingoflolz/mesh-transformer-jax' target='_blank'>GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model</a></p>\"\n",
    "examples = [\n",
    "    [\"The tower is 324 metres (1,063 ft) tall,\"],\n",
    "    [\"The Moon's orbit around Earth has\"],\n",
    "    [\"The smooth Borealis basin in the Northern Hemisphere covers 40%\"],\n",
    "]\n",
    "gr.Interface.load(\n",
    "    \"huggingface/EleutherAI/gpt-j-6B\",\n",
    "    inputs=gr.Textbox(lines=5, label=\"Input Text\"),\n",
    "    title=title,\n",
    "    description=description,\n",
    "    article=article,\n",
    "    examples=examples,\n",
    "    enable_queue=True,\n",
    ").launch()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gr.Interface.load(\"spaces/abidlabs/remove-bg\").launch()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gr.Interface.load(\n",
    "    \"spaces/abidlabs/remove-bg\", inputs=\"webcam\", title=\"Remove your webcam background!\"\n",
    ").launch()"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "name": "Tích hợp với Hugging Face Hub",
   "provenance": []
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
